﻿using SuperSocket;
using SuperSocket.Server;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace MoolinkHsmsServer.appSession
{
	public class HsmsAppSession : AppSession
	{
		protected override async ValueTask OnSessionConnectedAsync()
		{
			// do something right after the sesssion is connected
			//HsmsMessage p =new HsmsMessage();
			//p.LengthFrame.Length = 0x2C;
			//p.HeaderFrame.Stream = 1;
			//p.HeaderFrame.Function = 14;
			//p.HeaderFrame.Reply = true;
			//p.TextFrame.Bytes = ("01 02 21 01 00 01 02 41 11 4D 6F 6F 6C 69 6E 6B 48 73 6D 73 53 65 72 76 65 72 41 06 31 2E 30 30 2E 30").HexStringGetByteArray();
			////Console.WriteLine("OnSessionConnectedAsync()");
			//await Channel.SendAsync(p.GetByteArray());
			this.DataContext = new HsmsMessage();
			this["Lock"] = true;
			this["DeviceType"] = "";
			this["DeviceId"] = 0;
			this["ApiReqId"] = 0;
			this["WebSocket"] = null;
			//HsmsMessage p = new HsmsMessage();
			//p.LengthFrame.Length = 10;
			//p.HeaderFrame.Stype = 1; //选择响应（Select.rsp）
			//p.HeaderFrame.StreamFunction(0x0000);
			//p.HeaderFrame.Reply = false;
			//p.TextFrame.Bytes = null;
			//p.RefreshSystemByte();
			//await Channel.SendAsync(p.GetByteArray());

			//await Task.Delay(0);
		}

		//protected override async ValueTask OnSessionClosedAsync(EventArgs e)
		//{
		//    // do something right after the sesssion is closed
		//}
	}

	//public class PlayerSession : AppSession
	//{
	//	public int GameHallId { get; internal set; }

	//	public int RoomId { get; internal set; }
	//}

}
